objs = a.o b.o c.o
dep_files := $(patsubst %, .%.d, $(objs))

dep_files := $(wildcard $(dep_files))

CFLAGS = -Werror -I.

test: $(objs)
	gcc -o test $^ 
	# @echo dep_files = $(dep_files)

ifneq ($(dep_files),)
include $(dep_files)
endif

%.o: %.c
	gcc $(CFLAGS) -c -o $@ $< -MD -MF .$@.d

.PHONY:clean
clean:
	rm -rf test
	rm -rf *.o

distclean:
	rm $(dep_files) 

